/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nc.kyiv.yellow.sociallibrary.filters;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Evgeniy Grigorevskiy
 */
public class FilterConfigClass {
    //if there is some time, I'll make listener for config-file too
    private Map requestAndRole= new HashMap <String, String>();
    public FilterConfigClass(){
        //all request's type must be here and post a minimal role ...
        //if user's role is lower than this request is denied
        requestAndRole.put("registration", "4");
        requestAndRole.put("addingNewBookToGlobal", "4");
        requestAndRole.put("getGlobalLibrary","4");
        requestAndRole.put("isbnSearch","4");
        requestAndRole.put("getLocalLibrary", "5");
        requestAndRole.put("addBookToLocal", "5");
        requestAndRole.put("deleteBook","5");
        requestAndRole.put("changeStatusLocalLibrary", "5");
        requestAndRole.put("userVoted","5");
        requestAndRole.put("changeStatusPublicationBook", "6");
        requestAndRole.put("getPublishLibraryUser", "6");
        requestAndRole.put("getPublishLibraryGuests", "7");
    }
    public int checkAccess(String userRole){
        return Integer.parseInt(requestAndRole.get(userRole).toString());
    }
}
